﻿<Controls:MetroWindow x:Class="WPF.TestEditor.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"   
        xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
        xmlns:usr="clr-namespace:WPF.TestEditor.Controls"
        xmlns:hsr="clr-namespace:WPF.TestEditor.Controls.History"
        Title="Easy Auto Test"
        Height="{Binding Settings[Height], Mode=TwoWay, Converter={StaticResource SettingConv}}"
        Width="{Binding Settings[Width], Mode=TwoWay, Converter={StaticResource SettingConv}}"
        Left="{Binding Settings[Left], Mode=TwoWay, Converter={StaticResource SettingConv}}"
        Top="{Binding Settings[Top], Mode=TwoWay, Converter={StaticResource SettingConv}}"                           
        SaveWindowPosition="True" MinHeight="400" MinWidth="800" Icon="/WPF.EasyTestEditor;component/Resources/app.ico">

    <Controls:MetroWindow.WindowCommands>
        <Controls:WindowCommands>
            <Button Content="New" ToolTip="create new test in same application/project" Name="topMnuNew"/>
            <Button Content="Save" Name="topMnuSave" />
            <Button Content="Run" Name="topMnuExecute" />
        </Controls:WindowCommands>
    </Controls:MetroWindow.WindowCommands>
    <Border Padding="8" CornerRadius="0"  Background="{x:Null}">
        <Grid x:Name="LayoutRoot" Background="{x:Null}" Grid.RowSpan="4">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            <Menu Grid.Row="0" Grid.Column="0" Background="{x:Null}" IsMainMenu="True"  Name="mnuMail">
                <MenuItem Header="_File" Name="mnuFile" Background="{x:Null}" BorderBrush="Transparent" BorderThickness="0" InputGestureText="Ctrl+F">
                    <MenuItem Header="New" Name="mnuFileNew" InputGestureText="Ctrl+N">
                        <MenuItem.Icon>
                            <Image Source="Resources/new16.png" Width="16" Height="16" />
                        </MenuItem.Icon>
                    </MenuItem>
                    <Separator />
                    <MenuItem Header="_Open ... " Name="mnuFileOpen"  InputGestureText="Ctrl+O"/>
                    <Separator />
                    <MenuItem Header="_Save" Name="mnuFileSave"  InputGestureText="Ctrl+S"/>
                    <MenuItem Header="_Save as ... " Name="mnuFileSaveAs"  InputGestureText="Ctrl+Shift+S"/>
                    <Separator />
                    <MenuItem Header="Exit" Name="mnuExit"  InputGestureText="Ctrl+Q"/>
                </MenuItem>
                <MenuItem Header="_Actions" Name="mnuActions"  InputGestureText="Ctrl+A"/>
                <MenuItem Header="Se_ttings" Name="mnuSettings"  InputGestureText="Ctrl+T">
                    <MenuItem Header="Auto generate constants" Name="mnuSettingsAutoConsts"  IsCheckable="True" IsChecked="true"/>
                    <Separator />
                    <MenuItem Header="Execute Continiously" Name="mnuExecuteContiniously" Tag="0"  IsCheckable="True" IsChecked="True" Click="mnuExecute_Checked" ToolTip="For each selected browser test could be executed parallel..."/>
                    <MenuItem Header="Execute With Screenshots" Name="mnuExecuteWithScreenShots" Tag="1"  IsCheckable="True" IsChecked="True"  Click="mnuExecute_Checked" ToolTip="After each step system could make screenshot"/>
                    <MenuItem Header="Stop on first error" Name="mnuExecuteStopTestOnFirstError" Tag="2" IsCheckable="True" IsChecked="True"  Click="mnuExecute_Checked" ToolTip="could stop or continue test execution even if step already failed!"/>
                    <Separator />
                    <MenuItem Header="Test engine" Name="mnuEngine"  ToolTip="here you could overview which test engine will eb used to work with test"/>
                </MenuItem>
                <MenuItem Header="_View &amp; Help" Name="mnuViewAndHelp"  InputGestureText="Ctrl+V">
                    <MenuItem Header="Visual Theme" Name="mnuCurTheme" />
                    <MenuItem Header="Text Mode" ToolTip="Edit test in text mode editor" Name="mnuViewTextMode" IsCheckable="True" Tag="1" Checked="mnuViewMode_Checked"/>
                    <MenuItem Header="Table Mode" ToolTip="Edit test in Table mode editor" Name="mnuViewTableMode" IsCheckable="True" Tag="0" Checked="mnuViewMode_Checked"/>
                    <Separator/>
                    <MenuItem Header="Constants Editor" ToolTip="Edit all current project constants" Name="mnuViewConstantsMode" IsCheckable="true" Tag="2" Checked="mnuViewMode_Checked"/>
                    <MenuItem Header="Execution History" ToolTip="Overview &amp; Edit all execution results" Name="mnuViewHistortyMode" IsCheckable="true" Tag="3" Checked="mnuViewMode_Checked"/>
                    <Separator/>
                    <MenuItem Header="Execute Test" ToolTip="" Name="mnuViewExecuteMode" IsCheckable="true" Tag="4" Checked="topMnuExecute_Click"/>
                </MenuItem>
            </Menu>
            <Grid Grid.Row="1"  Grid.Column="0" Background="Transparent" x:Name="currentTestInfoLayout" >
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="350" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                <TextBlock Grid.Column="0" Text="Test Info:"  Style="{DynamicResource StandardWindowLabel}" />
                <TextBox Grid.Column="1" Name="txtCurTest" Style="{DynamicResource StandardTextBox}" IsReadOnly ="true"/>
                <Grid Name="tbxMainButtons" Grid.Column="2" Margin="0 0 0 0">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="*"  />
                    </Grid.ColumnDefinitions>
                    <Button  Grid.Column="0"  Margin="-20 0 15 0" Content=". . ." ToolTip="open other test" Name="ttbFileOpen" Style="{DynamicResource ChromelessButtonStyle}"/>
                    <Button  Grid.Column="1"  Content="Save" ToolTip="save changes" Name="ttbSaveChanges"  Style="{DynamicResource MetroButton}"/>
                    <usr:BrowsersSelector  Grid.Column="2"  x:Name="usrBrowsers" Margin="0 0 4 0"/>
                </Grid>
            </Grid>
            <TabControl x:Name="tabModes" Grid.Row="2" Grid.Column="0" Style="{DynamicResource MetroTabControl}" SelectedIndex="-1" SelectionChanged="tabModes_SelectionChanged">
                <TabItem Header="List Mode" Style="{DynamicResource MetroTabItem}" Name="tabPageListMode">
                    <usr:TestListEditor x:Name="usrTestListEditor" />
                </TabItem>
                <TabItem Header="Text Mode" Style="{DynamicResource MetroTabItem}"  Name="tabPageTextMode">
                    <usr:TestTextEditor x:Name="usrTestTextEditor" />
                </TabItem>
                <TabItem Header="All Constants"  Style="{DynamicResource MetroTabItem}" Name="tabPageConstansMode">
                    <usr:ConstantsTextEditor x:Name="txtConstTextEditor"  />
                </TabItem>
                <TabItem Header="History"   Style="{DynamicResource MetroTabItem}" Name="tabPageHistoryMode">
                    <hsr:HistoryView x:Name="hsrViewer"/>
                </TabItem>
            </TabControl>
            <TextBlock Grid.Row="3" x:Name="tssLabelInfo" Style="{DynamicResource MetroTextBlock}" Opacity="1"/>
        </Grid>
    </Border>
</Controls:MetroWindow>
